package com.sky.controller.user;

import com.sky.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.web.bind.annotation.*;

@RestController("userShopController")
@RequestMapping("/user/shop")
@Api(tags = "C端-店铺相关接口")
@Slf4j
public class ShopController {
    @Autowired
    RedisTemplate redisTemplate;
    public static final String SHOP_STATUS="SHOP_STATUS";

    /**
     * 设置状态的方法
     * 该方法用于执行状态设置的相关操作
     *
     * @return 返回一个Result对象，包含操作结果信息
     */
    @GetMapping("/status")
    @ApiOperation("获取店铺营业状态")
    public Result getStatus(){
        ValueOperations valueOperations = redisTemplate.opsForValue();
        Integer status = (Integer) valueOperations.get(SHOP_STATUS);
        log.info("店铺营业状态：{}",status);
        return Result.success(status);
    }

}